#ifndef STREAM_H
#define STREAM_H

#include <stdint.h>

typedef enum {
    SOURCE_USART1,
    SOURCE_USART2,
    SOURCE_USART3,
    SOURCE_USART4,
    SOURCE_USART5,
} STREAM_SOURCE_E;

typedef enum {
    STREAM_SUCCESS,
    STREAM_FAIL,
} STREAM_ERR_E;

typedef enum {
    U_REMAP_NO = 0,
    U_REMAP_PARTIAL = 1,
    U_REMAP_FULL = 2,
} USART_REMAP_E;

typedef struct {
    uint32_t badurate;
    USART_REMAP_E remap;
} SOURCE_USART_PARAM_T;

void StreamInit(STREAM_SOURCE_E source, void * param);
STREAM_ERR_E StreamReadC(STREAM_SOURCE_E source, uint8_t * out);
uint32_t StreamReads(STREAM_SOURCE_E source, uint8_t * out, uint32_t read_len, uint32_t outtime_ms);
STREAM_ERR_E StreamWriteC(STREAM_SOURCE_E source, uint8_t out);
uint32_t StreamWrites(STREAM_SOURCE_E source, uint8_t * out, uint32_t len);
void StreamTest(STREAM_SOURCE_E source, USART_REMAP_E remap);

#endif
